package com.ruoyi.web.studentmanagementsystem.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.web.studentmanagementsystem.dto.*;
import com.ruoyi.web.studentmanagementsystem.pojo.SysScore;
import com.ruoyi.web.studentmanagementsystem.service.ISysScoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: ScoreController
 * Package: com.ruoyi.web.studentmanagementsystem.controller
 * Description:
 *
 * @Author Mr. o
 * @Create 2023/11/10 16:00
 * @Version 1.0
 */
@RestController
@RequestMapping("/ISysScoreService")
@Api(tags = "成绩表接口相关")
public class ScoreController {
    @Resource
    @Autowired
    private ISysScoreService iSysScoreService;

    @PostMapping(  "/insertScore")
    @ApiOperation("成绩表——增")
    public R<String> insertScore(@RequestBody ISysScoreDTO score) {
        iSysScoreService.insertScore(score);
        return R.ok();
    }

    @PostMapping(  "/deleteScore/{studentId}")
    @ApiOperation("成绩表——删")
    public R<String> deleteScore(@PathVariable String studentId) {
        iSysScoreService.deleteScore(studentId);
        return R.ok();
    }

    @PostMapping(  "/selectScore/{studentId}")
    @ApiOperation("成绩表——查")
    public R<List<SysScore>> selectScore(@PathVariable String studentId) {
        return R.ok(iSysScoreService.selectScore(studentId));
    }

    @PostMapping(  "/updateScore")
    @ApiOperation("成绩表——改")
    public R<String> updateScore(@RequestBody IISysScoreDTO score) {
        iSysScoreService.updateScore(score);
        return R.ok();
    }
}
